//
//  BySuperLottoListHeadView.m
//  caipiao_ios
//
//  Created by mc on 2018/7/16.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "BySuperLottoListHeadView.h"

@implementation BySuperLottoListHeadView

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = BY_THEME_COLOR;
        
        
        UILabel *topLabel = [[UILabel alloc] init];
        [self addSubview:topLabel];
        [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(10);
            make.left.equalTo(self).offset(10);
            make.right.equalTo(self).offset(-10);
            make.height.mas_equalTo(@20);
        }];
        topLabel.textColor = [UIColor whiteColor];
        topLabel.font = FONT(14);
        topLabel.text = @"第10001期 今天 17:00 截止投注 奖池3亿3333万";
        self.topLabel = topLabel;
        
        
        CGFloat width = (SCREEN_WIDTH - 20 * 2 - 30 * 2) / 3.0;
        UIButton *centerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:centerBtn];
        [centerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(-15);
            make.size.mas_equalTo(CGSizeMake(width, 30));
        }];
        centerBtn.backgroundColor = rgba(235, 83, 87, 1);
        [centerBtn setTitle:@"加机选5注" forState:UIControlStateNormal];
        [centerBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        centerBtn.titleLabel.font = FONT(14);
        [centerBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        centerBtn.tag = 200;
        centerBtn.layer.cornerRadius = 5;
        
        
        UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:leftBtn];
        [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20);
            make.bottom.equalTo(centerBtn.mas_bottom).offset(0);
            make.size.mas_equalTo(CGSizeMake(width, 30));
        }];
        leftBtn.backgroundColor = rgba(235, 83, 87, 1);
        [leftBtn setTitle:@"加机选1注" forState:UIControlStateNormal];
        [leftBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        leftBtn.titleLabel.font = FONT(14);
        [leftBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        leftBtn.tag = 100;
        leftBtn.layer.cornerRadius = 5;
        
        UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:rightBtn];
        [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self).offset(-20);
            make.bottom.equalTo(centerBtn.mas_bottom).offset(0);
            make.size.mas_equalTo(CGSizeMake(width, 30));
        }];
        rightBtn.backgroundColor = rgba(235, 83, 87, 1);
        [rightBtn setTitle:@"加手动选号" forState:UIControlStateNormal];
        [rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        rightBtn.titleLabel.font = FONT(14);
        [rightBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        rightBtn.tag = 300;
        rightBtn.layer.cornerRadius = 5;
        
    }
    return self;
}

- (void)btnAction:(UIButton *)btn{
    if (btn.tag == 100) {
        if (self.leftBlock) {
            self.leftBlock();
        }
    }else if (btn.tag == 200){
        if (self.centerBlock) {
            self.centerBlock();
        }
    }else if (btn.tag == 300){
        if (self.rightBlock) {
            self.rightBlock();
        }
    }
    
}



@end
